home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Macademic for Students & Teachers
/
Macademic for Students and Teachers (Quantum Leap)(1992).iso
/
Fun & Games
/
CoreWar
/
Rattlesnake
< prev
next >
Wrap
Text File
|
1987-04-05
|
2KB
|
89 lines
* Rattlesnake (A hopping vampire)
* Ames Cornish[76214,435] -- 4/3/87
*
* Rattlesnake regularly defeats the Five Musketeers,
* Smart Vampire, and even the Worm.
*
* To give the other side a chance, I strongly suggest
* that you load the fighters into RANDOM locations.
*
* Rattlesnake consists of two coroutines: a fang placing
* routine and a replicating routine. The fang placing
* uses the standard Vampire algorithm (almost), the
* replicating routine allows Rattlesnake to "hop" over
* most attacks. It also checks its new home for integrity
* before relocating.
*
* Have fun!!
*
@-7
FIRST dat 333
*
* Trap routine:
*
HITS dat 500 ;HAVE WE CAUGHT ANYONE?
SPIN spl 0 ;HERE'S OUR TRAP
djz NULL,HITS
jmp -2
NULL mov 1,SPIN
jmp 0
*
*
@0
START mov #-4000,BITE
spl DUP
*
* Vampire (fang-placing) routine:
*
PLACE mov #(SPIN-BITE),@BITE ;PLACE FANGS IN MEMORY
sub BITE,@BITE
sub #1,BITE
mov FANG,@BITE
sub #7,BITE
jmp PLACE
*
BITE dat 0
FANG jmp @1
*
* Replicating (hopping) routine:
*
DUP mov DIST,TO ;Replicate program
sub #(TO-FIRST),TO
mov #(FIRST-FROM),FROM
DLP1 mov @FROM,@TO
cmp FROM,#(LAST-FROM)
jmp CHK
add #1,FROM
add #1,TO
jmp DLP1
*
CHK cmp FIRST-2100,#333 ;Is new copy OK?
jmp 2
jmp DUP
cmp LAST-2100,#333
jmp 2
jmp DUP ;If not OK, reduplicate
*
HOP cmp HITS,#500 ;CAUGHT ANYONE?
jmp 2
jmp WIPE ;If so, wipe memory
mov RELOC,SPIN ;SEND VAMPIRE AND TRAPPED
mov #0,PLACE ;ROUTINES TO NEW LOCATIONS
jmp START-2100
*
DIST dat -2100 ;How far to hop
RELOC jmp -2100 ;Relocation instruction
FROM dat 0 ;Source for copy
TO dat 0 ;Destination for copy
ZERO dat LAST-7999 ;Destination for "bombs"
*
* Routine to clear memory:
*
WIPE mov #0,PLACE ;KILL VAMPIRE ROUTINE, AND
mov #0,@ZERO ;FILL MEMORY WITH ZEROES
add #1,ZERO
cmp ZERO,#(WIPE-ZERO) ;finished wipe?
jmp 0 ;if so, then wait.
jmp -4
*
LAST dat 333